//package com.kungfuhacking.wristbandpro.find.presenter;
//
//import android.text.TextUtils;
//
//import com.alibaba.fastjson.JSONObject;
//import com.kungfuhacking.wristbandpro.base.bean.RequestBean;
//import com.kungfuhacking.wristbandpro.base.presenter.BasePresenter;
//import com.kungfuhacking.wristbandpro.find.bean.LogisticsBean;
//import com.kungfuhacking.wristbandpro.find.view.ILogisticsView;
//import com.kungfuhacking.wristbandpro.login.activity.LoginActivity;
//import com.kungfuhacking.wristbandpro.net.BaseNoTObserver;
//import com.kungfuhacking.wristbandpro.net.RetrofitHttpUtil;
//
//import io.reactivex.disposables.Disposable;
//
//
///**
// * Created by Aaron on 17/5/11.
// */
//
//public class ILogisticsPresenter implements BasePresenter {
//
//    private ILogisticsView iLogisticsView;
//
//    public ILogisticsPresenter(ILogisticsView iLogisticsView) {
//        this.iLogisticsView = iLogisticsView;
//    }
//
//    /**
//     * 获取物流信息
//     *
//     * @param tradeNo
//     */
//    public void getLogisticsInfo(String tradeNo) {
//
//        if (TextUtils.isEmpty(tradeNo)) {
//            iLogisticsView.showErr("订单号错误");
//            return;
//        }
//
//        JSONObject request = new JSONObject();
//        request.put("token", iLogisticsView.getToken());
//        request.put("tradeNo", tradeNo);
////      request.put("tradeNo", "20160930150203466628247668751368");
//
//        RetrofitHttpUtil.getInstance().checkExpress(new BaseNoTObserver<LogisticsBean>() {
//            @Override
//            public void onHandleSuccess(LogisticsBean basebean) {
//                iLogisticsView.hideLoading();
//
//                if (basebean.getRe() == null) {
//                    iLogisticsView.showErr("未查询到信息");
//                    return;
//                }
//
//                String logicticsStatus = "";//快递状态
//                switch (basebean.getRe().getDeliverystatus()) {
//
//                    case 1:
//                        logicticsStatus = "在途中";
//                        break;
//
//                    case 2:
//                        logicticsStatus = "派件中";
//                        break;
//
//                    case 3:
//                        logicticsStatus = "已签收";
//                        break;
//
//                    case 4:
//                        logicticsStatus = "派送失败";
//                        break;
//
//                }
//
//                iLogisticsView.setStatus(logicticsStatus);//是否签收
//                iLogisticsView.setCode(basebean.getRe().getNumber());//快递单号
//                iLogisticsView.setAdapterInfo(basebean.getRe().getList());
//
//                if (basebean.getRe().getExpressInfo() == null)
//                    return;
//
//                iLogisticsView.setCompany(basebean.getRe().getExpressInfo().getName());//快递公司
//                iLogisticsView.setNum(basebean.getRe().getExpressInfo().getNumber());//快递公司电话
//
//            }
//
//            @Override
//            public void onHandleError(String message) {
//                iLogisticsView.hideLoading();
//                iLogisticsView.showErr(message);
//            }
//
//            @Override
//            public void onReLogin(String message) {
//                iLogisticsView.showErr(message);
//                iLogisticsView.hideLoading();
//                iLogisticsView.nextActivityWithSingleTask(LoginActivity.class);
//            }
//
//            @Override
//            public void onSubscribe(Disposable d) {
//                compositeDisposable.add(d);
//                iLogisticsView.showLoading("加载中...");
//            }
//        }, new RequestBean().setData(request.toString()));
//
//    }
//
//    @Override
//    public void clearRequest() {
//        compositeDisposable.clear();
//    }
//}
